using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._GeoAnalyticsServerTools._AnalyzePatterns
{
    /// <summary>
    /// <para>Find Point Clusters</para>
    /// <para>Finds clusters of point features in surrounding noise based on their spatial or spatiotemporal distribution.</para>
    /// <para>根据周围噪声的空间或时空分布查找点要素聚类。</para>
    /// </summary>    
    [DisplayName("Find Point Clusters")]
    public class FindPointClusters : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public FindPointClusters()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_input_points">
        /// <para>Input Point Layer</para>
        /// <para>The point feature class containing the point clusters.</para>
        /// <para>包含点聚类的点要素类。</para>
        /// </param>
        /// <param name="_output_name">
        /// <para>Output Name</para>
        /// <para>The name of the output feature service.</para>
        /// <para>输出要素服务的名称。</para>
        /// </param>
        /// <param name="_minimum_points">
        /// <para>Minimum Features per Cluster</para>
        /// <para><xdoc>
        ///   <para>This parameter is used differently depending on the clustering method chosen as follows:</para>
        ///   <para>
        ///     <bulletList>
        ///       <bullet_item>Defined distance (DBSCAN)—Specifies the number of features that must be found within a certain distance of a point for that point to start to form a cluster. The distance is defined using the Search Distance parameter.</bullet_item><para/>
        ///       <bullet_item>Self-adjusting (HDBSCAN)—Specifies the number of features neighboring each point (including the point) that will be considered when estimating density. This number is also the minimum cluster size allowed when extracting clusters.</bullet_item><para/>
        ///     </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>根据所选的聚类分析方法，此参数的使用方式不同，如下所示：</para>
        ///   <para>
        ///     <bulletList>
        ///       <bullet_item>定义距离 （DBSCAN） - 指定必须在点的一定距离内找到的要素数，该点才能开始形成聚类。使用搜索距离参数定义距离。</bullet_item><para/>
        ///       <bullet_item>自调整 （HDBSCAN） - 指定估计密度时要考虑的每个点 （包括点） 相邻的要素数。此数字也是提取集群时允许的最小集群大小。</bullet_item><para/>
        ///     </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// </param>
        public FindPointClusters(object _input_points, object _output_name, long? _minimum_points)
        {
            this._input_points = _input_points;
            this._output_name = _output_name;
            this._minimum_points = _minimum_points;
        }
        public override string ToolboxName => "GeoAnalytics Server Tools";

        public override string ToolName => "Find Point Clusters";

        public override string CallName => "geoanalytics.FindPointClusters";

        public override List<string> AcceptEnvironments => ["extent", "outputCoordinateSystem", "workspace"];

        public override object[] ParameterInfo => [_input_points, _output_name, _minimum_points, _search_distance, _data_store.GetGPValue(), _output, _clustering_method.GetGPValue(), _use_time.GetGPValue(), _search_duration];

        /// <summary>
        /// <para>Input Point Layer</para>
        /// <para>The point feature class containing the point clusters.</para>
        /// <para>包含点聚类的点要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Point Layer")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _input_points { get; set; }


        /// <summary>
        /// <para>Output Name</para>
        /// <para>The name of the output feature service.</para>
        /// <para>输出要素服务的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_name { get; set; }


        /// <summary>
        /// <para>Minimum Features per Cluster</para>
        /// <para><xdoc>
        ///   <para>This parameter is used differently depending on the clustering method chosen as follows:</para>
        ///   <para>
        ///     <bulletList>
        ///       <bullet_item>Defined distance (DBSCAN)—Specifies the number of features that must be found within a certain distance of a point for that point to start to form a cluster. The distance is defined using the Search Distance parameter.</bullet_item><para/>
        ///       <bullet_item>Self-adjusting (HDBSCAN)—Specifies the number of features neighboring each point (including the point) that will be considered when estimating density. This number is also the minimum cluster size allowed when extracting clusters.</bullet_item><para/>
        ///     </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>根据所选的聚类分析方法，此参数的使用方式不同，如下所示：</para>
        ///   <para>
        ///     <bulletList>
        ///       <bullet_item>定义距离 （DBSCAN） - 指定必须在点的一定距离内找到的要素数，该点才能开始形成聚类。使用搜索距离参数定义距离。</bullet_item><para/>
        ///       <bullet_item>自调整 （HDBSCAN） - 指定估计密度时要考虑的每个点 （包括点） 相邻的要素数。此数字也是提取集群时允许的最小集群大小。</bullet_item><para/>
        ///     </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Features per Cluster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public long? _minimum_points { get; set; }


        /// <summary>
        /// <para>Search Distance</para>
        /// <para><xdoc>
        ///   <para>The maximum distance to be considered.</para>
        ///   <para>The Minimum Features per Cluster specified must be found within this distance for cluster membership. Individual clusters will be separated by at least this distance. If a feature is located farther than this distance from the next closest feature in the cluster, it will not be included in the cluster.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要考虑的最大距离。</para>
        ///   <para>对于集群成员资格，必须在此距离内找到指定的每个集群的最小要素。单个集群将至少相隔此距离。如果要素与聚类中下一个最近的要素的距离远于此距离，则该要素将不包括在聚类中。</para>
        /// </xdoc></para>
        /// <para>单位： Feet | Yards | Miles | NauticalMiles | Meters | Kilometers </para>
        /// </summary>
        [DisplayName("Search Distance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _search_distance { get; set; } = null;


        /// <summary>
        /// <para>Data Store</para>
        /// <para><xdoc>
        ///   <para>Specifies the ArcGIS Data Store where the output will be saved. The default is Spatiotemporal big data store. All results stored in a spatiotemporal big data store will be stored in WGS84. Results stored in a relational data store will maintain their coordinate system.</para>
        ///   <bulletList>
        ///     <bullet_item>Spatiotemporal big data store—Output will be stored in a spatiotemporal big data store. This is the default.</bullet_item><para/>
        ///     <bullet_item>Relational data store—Output will be stored in a relational data store.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将保存输出的 ArcGIS Data Store。默认值为 Spatiotemporal 大数据存储。存储在时空大数据存储中的所有结果都将存储在 WGS84 中。存储在关系数据存储中的结果将保留其坐标系。</para>
        ///   <bulletList>
        ///     <bullet_item>时空大数据存储 - 输出将存储在时空大数据存储中。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>关系数据存储 - 输出将存储在关系数据存储中。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Data Store")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _data_store_value _data_store { get; set; } = _data_store_value._SPATIOTEMPORAL_DATA_STORE;

        public enum _data_store_value
        {
            /// <summary>
            /// <para>Spatiotemporal big data store</para>
            /// <para>Spatiotemporal big data store—Output will be stored in a spatiotemporal big data store. This is the default.</para>
            /// <para>时空大数据存储 - 输出将存储在时空大数据存储中。这是默认设置。</para>
            /// </summary>
            [Description("Spatiotemporal big data store")]
            [GPEnumValue("SPATIOTEMPORAL_DATA_STORE")]
            _SPATIOTEMPORAL_DATA_STORE,

            /// <summary>
            /// <para>Relational data store</para>
            /// <para>Relational data store—Output will be stored in a relational data store.</para>
            /// <para>关系数据存储 - 输出将存储在关系数据存储中。</para>
            /// </summary>
            [Description("Relational data store")]
            [GPEnumValue("RELATIONAL_DATA_STORE")]
            _RELATIONAL_DATA_STORE,

        }

        /// <summary>
        /// <para>Output Feature Layer</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Feature Layer")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _output { get; set; }


        /// <summary>
        /// <para>Clustering Method</para>
        /// <para><xdoc>
        ///   <para>Specifies the method that will be used to define clusters.</para>
        ///   <bulletList>
        ///     <bullet_item>Defined distance (DBSCAN)— Uses a specified distance to separate dense clusters from sparser noise. DBSCAN is the fastest of the clustering methods but is only appropriate if there is a clear distance that works well to define all clusters that may be present. This results in clusters that have similar densities. This is the default.</bullet_item><para/>
        ///     <bullet_item>Self-adjusting (HDBSCAN)— Uses varying distances to separate clusters of varying densities from sparser noise. HDBSCAN is the most data driven of the clustering methods and requires the least user input.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将用于定义群集的方法。</para>
        ///   <bulletList>
        ///     <bullet_item>定义距离 （DBSCAN） — 使用指定的距离将密集簇与稀疏噪声分开。DBSCAN 是最快的聚类方法，但仅当存在一个清晰的距离来定义可能存在的所有聚类时，DBSCAN 才适用。这会导致具有相似密度的聚类。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>自调整 （HDBSCAN） — 使用不同的距离将不同密度的簇与稀疏噪声分开。HDBSCAN是聚类方法中数据驱动的方法，需要的用户输入最少。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Clustering Method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _clustering_method_value _clustering_method { get; set; } = _clustering_method_value._DBSCAN;

        public enum _clustering_method_value
        {
            /// <summary>
            /// <para>Defined distance (DBSCAN)</para>
            /// <para>Defined distance (DBSCAN)— Uses a specified distance to separate dense clusters from sparser noise. DBSCAN is the fastest of the clustering methods but is only appropriate if there is a clear distance that works well to define all clusters that may be present. This results in clusters that have similar densities. This is the default.</para>
            /// <para>定义距离 （DBSCAN） — 使用指定的距离将密集簇与稀疏噪声分开。DBSCAN 是最快的聚类方法，但仅当存在一个清晰的距离来定义可能存在的所有聚类时，DBSCAN 才适用。这会导致具有相似密度的聚类。这是默认设置。</para>
            /// </summary>
            [Description("Defined distance (DBSCAN)")]
            [GPEnumValue("DBSCAN")]
            _DBSCAN,

            /// <summary>
            /// <para>Self-adjusting (HDBSCAN)</para>
            /// <para>Self-adjusting (HDBSCAN)— Uses varying distances to separate clusters of varying densities from sparser noise. HDBSCAN is the most data driven of the clustering methods and requires the least user input.</para>
            /// <para>自调整 （HDBSCAN） — 使用不同的距离将不同密度的簇与稀疏噪声分开。HDBSCAN是聚类方法中数据驱动的方法，需要的用户输入最少。</para>
            /// </summary>
            [Description("Self-adjusting (HDBSCAN)")]
            [GPEnumValue("HDBSCAN")]
            _HDBSCAN,

        }

        /// <summary>
        /// <para>Use Time to Find Clusters</para>
        /// <para><xdoc>
        ///   <para>Specifies whether or not time will be used to discover clusters with DBSCAN.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Spatiotemporal clusters will be found using both a search distance and a search duration.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Spatial clusters will be found using a search distance and time will be ignored. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否使用时间来发现具有 DBSCAN 的群集。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 将使用搜索距离和搜索持续时间查找时空聚类。</bullet_item><para/>
        ///     <bullet_item>未选中 - 将使用搜索距离查找空间聚类，并且将忽略时间。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Use Time to Find Clusters")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _use_time_value _use_time { get; set; } = _use_time_value._false;

        public enum _use_time_value
        {
            /// <summary>
            /// <para>TIME</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("TIME")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_TIME</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_TIME")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Search Duration</para>
        /// <para>When searching for cluster members, the specified minimum number of points must be found within this time duration to form a cluster.</para>
        /// <para>搜索集群成员时，必须在此时间段内找到指定的最小点数才能形成集群。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Search Duration")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _search_duration { get; set; } = null;


        public FindPointClusters SetEnv(object extent = null, object outputCoordinateSystem = null, object workspace = null)
        {
            base.SetEnv(extent: extent, outputCoordinateSystem: outputCoordinateSystem, workspace: workspace);
            return this;
        }

    }

}